package com.cong.leetcode._338;

import org.junit.Before;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.*;

public class SolutionTest_338 {

    Map<Integer, int[]> expectMap;
    @Before
    public void setExpectMap() {
        expectMap = new HashMap<>();
        expectMap.put(1, new int[] {0, 1});
        expectMap.put(0, new int[] {0});
        expectMap.put(2, new int[] {0, 1, 1});
        expectMap.put(5, new int[]{0,1,1,2,1,2});
    }
    @Test
    public void countBits() {
        Solution s = new Solution();
        expectMap.forEach((k, v) -> {
            assertArrayEquals(s.countBits(k), expectMap.get(k));
        });

    }
}